package com.wang.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 多对一
 * @author Zjx
 */
@Configuration(proxyBeanMethods = true)
/**
 * 配置文件中的前缀,后面要跟上属性名
 * myconfig.king.name
 */
@ConfigurationProperties("myconfig.king")
public class Aking {
    private int id;
    private String name;
    /**
     * ${},中间写的是Spring配置文件中的键
     */
    @Value("${logging.level.root}")
    private String testStr;

    public Aking(){
        System.out.println("==构造函数执行,初始化==");
    }

    @Override
    public String toString() {
        return "Aking{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", testStr='" + testStr + '\'' +
                '}';
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
